home *** CD-ROM | disk | FTP | other *** search
/ PC Direct 1998 August / PC Direct August 1998.iso / S / powerj / Product / hpp.z / WOLEPOBJ.HPP < prev    next >
Encoding:
C/C++ Source or Header  |  1997-11-25  |  6.2 KB  |  185 lines

  1. /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2.    %     Copyright (C) 1994, by WATCOM International Inc.  All rights    %
  3.    %     reserved.  No part of this software may be reproduced or        %
  4.    %     used in any form or by any means - graphic, electronic or       %
  5.    %     mechanical, including photocopying, recording, taping or        %
  6.    %     information storage and retrieval systems - except with the     %
  7.    %     written permission of WATCOM International Inc.                 %
  8.    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  9. */
  10.  
  11. /*************************************************************************
  12.  *
  13.  * WOleProgrammableObject -- Ole Programmable Object
  14.  *
  15.  *
  16.  *   Events:
  17.  *
  18.  *
  19.  *************************************************************************/
  20.  
  21. #ifndef _WOLEPOBJ_HPP_INCLUDED
  22. #define _WOLEPOBJ_HPP_INCLUDED
  23.  
  24. #ifndef _WNO_PRAGMA_PUSH
  25. #pragma pack(push,8);
  26. #pragma enum int;
  27. #endif
  28.  
  29. #ifndef _WOLEBSTR_HPP_INCLUDED
  30. #   include "wolebstr.hpp"
  31. #endif
  32. #ifndef _WOLEOBJ_HPP_INCLUDED
  33. #   include "woleobj.hpp"
  34. #endif
  35.  
  36. // forward class declarations
  37. class WOleIDispatchHandler;
  38. class WOleEventHandler;
  39.  
  40. // the following is definitions of WOleProgrammableObject
  41.  
  42. class WCMCLASS WOleProgrammableObject : public WEventGenerator {
  43.     WDeclareSubclass( WOleProgrammableObject, WEventGenerator );
  44.  
  45.     public:
  46.  
  47.         /**********************************************************
  48.          * Constructors and Destructors
  49.          *********************************************************/
  50.  
  51.         WOleProgrammableObject();
  52.  
  53.         virtual ~WOleProgrammableObject();
  54.  
  55.     public:
  56.  
  57.         /**************************************************************
  58.          * Properties
  59.          **************************************************************/
  60.  
  61.         // Hot Link
  62.         WBool SetHotLink( WBool set );
  63.         WBool GetHotLink();
  64.  
  65.         // Remote Host
  66.         WBool SetRemoteHost( const WString & remoteHost );
  67.         WString GetRemoteHost() const;
  68.  
  69.         // read-only properties
  70.         WPICursor GetICursor( void ) const;
  71.         WBool GetHasICursor( void ) const;
  72.  
  73.         WBool GetOpened() const;
  74.         WBool GetModified() const;
  75.         WBool GetLinked() const;
  76.  
  77.         WPIUnknown GetObjectInterface() const;
  78.         WString GetObjectClassID() const;
  79.  
  80.         // read-only Licensing properties
  81.         WBool GetLicenseVerified() const;
  82.         WBool GetRuntimeKeyAvailable() const;
  83.         WBString GetRuntimeLicenseKey() const;
  84.  
  85.         // read-only Automation properties
  86.         WOleAutomationErrorInfo GetErrorInfo( void ) const;
  87.         WVariant GetLastResult( void ) const;
  88.         WVarType GetLastResultType( void ) const;
  89.  
  90.         // event notification method
  91.         WBool SetOleEventHandler( WObject *source, WDispIndex disp_index,
  92.                                   WDispID disp_id,
  93.                                   WControlEventHandler handler );
  94.  
  95.         /**************************************************************
  96.          * Methods
  97.          **************************************************************/
  98.  
  99.         // creation, initialization and destruction functions
  100.         WBool Create( WPIDispatch pIDispatch, WBool release=TRUE );
  101.         WBool Create( WPIUnknown pIUnknown, WBool release=TRUE );
  102.         WBool Create( const WBString *license=NULL );
  103.         WBool Create( WString const & classID, const WBString *license=NULL );
  104.         WBool CreateLink( WString const & linkSrc, const WBString *license=NULL );
  105.  
  106.         void Destroy();
  107.  
  108.         // Automation methods
  109.  
  110.         WBool GetEnumeratorElement( WUInt idx, WVariant & element );
  111.  
  112.         // the following will not cause ITypeInfo lookups
  113.         WBool Invoke( WMemberID memberID,
  114.                       WDispatchFlag flag, WUInt cvtParms,
  115.                       WVarType *vtParms, WVarType vtRet,
  116.                       void *result, ... );
  117.  
  118.         WBool Method( WMemberID memberID,
  119.                       WUInt cvtParms, WVarType *vtParms,
  120.                       WVarType vtRet, void *result, ... );
  121.  
  122.         WBool PropertyGet( WMemberID memberID, WVarType vtRet, void *result );
  123.         WBool PropertyPut( WMemberID memberID, WVarType vt, ... );
  124.         WBool PropertyPutRef( WMemberID memberID, WVarType vt, ... );
  125.  
  126.         WBool IDofName( const WString & name, WMemberID & id );
  127.  
  128.         // the following may cause ITypeInfo lookups
  129.         WBool Invoke( WMemberID memberID,
  130.                       WDispatchFlag flag, WVarType vtRet,
  131.                       void *result, const WOleParmList & parmlist );
  132.  
  133.         // object linking methods
  134.         WBool UpdateLink( void );
  135.  
  136.         // other methods
  137.         void FreezeControlEvents( WBool freeze );
  138.  
  139.         /**************************************************************
  140.          * Operators
  141.          **************************************************************/
  142.  
  143.         operator WPIUnknown() const;
  144.         operator WPIDispatch() const;
  145.         WVariant operator[]( int index ) {
  146.             WVariant    ret;
  147.             GetEnumeratorElement( index, ret );
  148.             return ret;
  149.         }
  150.  
  151.         /**************************************************************
  152.          * Internal members
  153.          **************************************************************/
  154.  
  155.     private:
  156.         virtual const WChar * GetRegisteredClass();
  157.  
  158.     /**********************************************************
  159.      * Data Members
  160.      *********************************************************/
  161.     
  162.     protected:
  163.         WOleIDispatchHandler    *_idispHandler;
  164.         WOleEventHandler        *_eventHandler;
  165.         WPIUnknown              _pIUnknown;
  166.         WString                 _progID;
  167.         WString                 _classID;
  168.         WBool                   _isLinked;
  169.         WBool                   _hotLink;
  170.         WBool                   _runTimeKeyAvail;
  171.         WBool                   _licVerified;
  172.         WBStr                   _licenseKey;
  173.         unsigned long           _cacheConnection;
  174.         WString                 _remoteHost;
  175.  
  176. };
  177.  
  178. #ifndef _WNO_PRAGMA_PUSH
  179. #pragma enum pop;
  180. #pragma pack(pop);
  181. #endif
  182.  
  183. #endif // _WOLEPOBJ_HPP_INCLUDED
  184.  
  185.